
function ListSelect(){
	this.title = "属性选择";
	this.saveService = "";
	this.groupLabel = "";
	this.groupDataSource = "";
	this.groupDataSourceType = "";
	this.defaultOption = "";
	this.selectListDataSourceType = "";
	this.selectListDataSource = "";
	this.selectedListDataSourceType = "";
	this.selectedListDataSource = "";
	this.searchLabel = "";
	this.selectListSqlId = "";
	this.selectedListSqlId = "";
	this.multiple = "true";
	this.params = "";
}
ListSelect.prototype.setGroup = function (groupLabel, groupDataSourceType, groupDataSource, defaultOption) {
    this.groupLabel = groupLabel;
    this.groupDataSource = groupDataSource;
    this.groupDataSourceType = groupDataSourceType;
    this.defaultOption = defaultOption;
}

ListSelect.prototype.setTitle = function(title)
{
	this.title = title;
}

ListSelect.prototype.setSearch = function(searchLabel)
{
    this.searchLabel = searchLabel;
}

ListSelect.prototype.setSaveService = function(saveService)
{
	this.saveService = saveService;
}

ListSelect.prototype.setSelectList = function(selectListDataSourceType,selectListDataSource)
{
    this.selectListDataSourceType = selectListDataSourceType;
    this.selectListDataSource = selectListDataSource;
}

ListSelect.prototype.setSelectedList = function(selectedListDataSourceType,selectedListDataSource)
{
    this.selectedListDataSourceType = selectedListDataSourceType;
    this.selectedListDataSource = selectedListDataSource;
}
ListSelect.prototype.setMultiple = function(multiple)
{
	this.multiple = multiple;
}
ListSelect.prototype.setParams = function(params)
{
	this.params = params;
}

/**
	弹出带保存功能的分类属性多选框
	参数path为当前系统的部署路径
*/
ListSelect.prototype.show = function (path) {
    url = this.createUrl(path);
    url += "&isSave=false&fromJs=true";
    var dialogParam = new Array();
    return showCenterModalDialog(url, 620, 520, dialogParam);
}

ListSelect.prototype.createUrl = function (path) {
    var url = "title=" + this.title;
    url = url + "&saveService=" + this.saveService;
    url = url + "&groupLabel=" + this.groupLabel;
    url = url + "&groupDataSource=" + this.groupDataSource;
    url = url + "&groupDataSourceType=" + this.groupDataSourceType;
    url = url + "&defaultOption=" + this.defaultOption;
    url = url + "&searchLabel=" + this.searchLabel;

    url = url + "&selectListDataSourceType=" + this.selectListDataSourceType;
    url = url + "&selectListDataSource=" + this.selectListDataSource;
    url = url + "&selectedListDataSourceType=" + this.selectedListDataSourceType;
    url = url + "&selectedListDataSource=" + this.selectedListDataSource;
    url = url + "&multiple=" + this.multiple;
    url = url + "&params=" + this.params;
    var myDate = new Date();
    url = url + "&time=" + myDate.getTime();
    url = path + "/Modules/SecurityConsole/Common/FunctionControl/ListSelect/ListSelect.aspx?" + url;
    url = encodeURI(url);
    //url = encodeURIComponent(url);
    return url;
}

var _ieVersion = getIEVersion();
/**
 * 打开一个居中的模式对话框
 */
function showCenterModalDialog(URL,dlgWidth,dlgHeight,arg){
	var _ie6_padding_height = 25;
    var dlgLeft = (window.screen.width-dlgWidth)/2;
    var dlgTop  = (window.screen.height-dlgHeight)/2;
    if(_ieVersion < 7){
    	dlgHeight = dlgHeight + _ie6_padding_height;
    }    
    
    var widthTmp = dlgWidth;
    var form    = "scroll:no;status:no;dialogHeight:" + dlgHeight + "px;dialogWidth:" + widthTmp + "px;dialogLeft:" + dlgLeft + ";dialogTop:" + dlgTop;
    var v = window.showModalDialog(URL,arg,form);
    return v;
}
function getIEVersion(){
	var ua = navigator.userAgent;
	if (ua.indexOf('MSIE 8')>-1)
		return 8;
	else if (ua.indexOf('MSIE 7')>-1)
		return 7;
	else
		return 6;
}
    